package cn.fengkuok.jantis.user.dao;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import cn.fengkuok.core.orm.hibernate.HibernateDao;
import cn.fengkuok.jantis.user.domian.model.User;

@Repository("userDao")
public class UserDao extends HibernateDao<User, Long>{
	private static final String HQL_QUERY_BY_USERNAME_PASSWORD = "FROM User u WHERE u.username = ? and u.password = ?";
	
	public User findForCheckLogin(User user){
		
		Query q = createQuery(HQL_QUERY_BY_USERNAME_PASSWORD, user.getUsername(), user.getPassword());
		
		return (User)q.uniqueResult();
	}
}
